package admin;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;

import java.awt.Dimension;

public class AdminFrame extends JFrame implements ActionListener{
	
	Dimension frameSize;
	
	
	JMenuBar menuBar;
	JMenu userMenu;
	
	JMenuItem userMenuItem;
	JMenuItem workerMenuItem;
	JMenuItem customerMenuItem;
	
	public AdminFrame(){
		
		super();
		frameSize = new Dimension(600, 600);
		
		this.setSize(frameSize);
		this.setTitle("Admin");
		this.setDefaultCloseOperation(EXIT_ON_CLOSE);
		
		
		menuBar = new JMenuBar();
		userMenu = new JMenu("User");
		
		menuBar.add(userMenu);
		
		userMenuItem = new JMenuItem("User");
		workerMenuItem = new JMenuItem("Worker");
		customerMenuItem = new JMenuItem("Customer");
		
		userMenu.add(userMenuItem);
		userMenu.add(workerMenuItem);
		userMenu.add(customerMenuItem);
		
		userMenuItem.addActionListener(this);
		workerMenuItem.addActionListener(this);
		customerMenuItem.addActionListener(this);
		
		this.setJMenuBar(menuBar);
		//this.setContentPane(new UserAdmin());
		this.setVisible(true);
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		if(e.getSource() == userMenuItem){
			this.setContentPane(new UserAdmin(frameSize));
			this.setTitle("User - Admin");
		}
		if(e.getSource() == workerMenuItem){
			this.setContentPane(new WorkerAdmin(frameSize));
			this.setTitle("Worker - Admin");
		}
		if(e.getSource() == customerMenuItem){
			this.setContentPane(new CustomerAdmin(frameSize));
			this.setTitle("Customer - Admin");
		}
		
	}
	
	
}
